<!--tvm票款差异协查-->
<template>
  <div class="zhanNeiRYDLCK approve el-card is-always-shadow el-card__body">
    <el-dialog
      title="确认"
      :visible.sync="dialogVisible"
      @close="closed"
      width="950px">
      <avue-form v-if="isReload" class="shouPiaoYuanCYQRTZForm" :option="option" v-model="formData" @submit="affirm">

        <template slot-scope="scope" slot="differenceAmount">
          <span>{{fenExYuangettoFixed(scope,'value')}}</span>
        </template>

        <template slot-scope="scope" slot="menuForm">
          <el-button type="primary" @click="affirm()">确认</el-button>
          <el-button type="default" @click="closed">取消</el-button>
        </template>
      </avue-form>
    </el-dialog>
  </div>
</template>


<script>
import {
  fenExYuangettoFixed
} from "@/api/subwayRat/commonCheck";
import {affirmSwAuTvmNotice} from '@/api/subwayRat/swAuTvm/tvmCYQRTZ'

export default {
  components:{
  },
  data() {
    return {
      isReload:true,
      //1期限内，2期限外
      showType:1,
      dialogVisible:true,
      lineCodes:[],
      selectedKeys:[],
      stationCodes:[],
      conductorPersonNames:[],//售票员名称
      operationCodes:[],
      headers:{},
      formData:{
        dynamic: []
      },
      option:{
      },
      parentThis:null
    }
  },
  created() {
  },
  methods: {
    fenExYuangettoFixed,
    affirm(){
      let th=this;
      if (this.formData.remark == null || this.formData.remark == '') {
        th.$message.error("请填写车站备注！");
        return false;
      }
      this.$confirm("是否确认?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        affirmSwAuTvmNotice({
          id:this.formData.id,
          remark:this.formData.remark
        }).then(res=>{
          th.$message.success("确认成功！");
          th.closed();
          th.parentThis.getList();
        })
          .catch(() => {
            th.$message.error("确认失败！");
          });
      });
    },
    recallShow(row,parentThis){
      this.parentThis=parentThis;
      this.getOption();
      this.formData=row;
    },
    closed(){
      this.dialogVisible=false;
      this.$parent.dialogVisibleAppealReply=false;
    },
    getOption(){
      let th=this;
      this.option=this.getAddOption(th);
      this.isReload=false;
      this.$nextTick(()=>{
        this.isReload=true;
      })
    },
    uploadSuccess(response, file, fileList){
      this.formData.fileUrl=file.name;
      this.list=response.data;
      this.dialogVisible=true;
      this.getOption();
      console.log(response, file, fileList)
    },
    getAuth(){
      const token = this.$store.getters.access_token;
      if (token) {
        this.headers['Authorization'] = 'Bearer ' + token// token
      }
    },
    getAddOption(th) {
      return {
        submitBtn:false,
        emptyBtn:false,
        group:[
          {
            icon:'',
            label: '',
            // collapse:false,
            prop: 'group1',
            column: [{
              label: '售票员',
              prop: 'conductorPersonName',
              labelWidth:130,
              // formslot:true,
              type:'select'
            },{
              label: '售票员工号',
              prop: 'conductorPersonCode',
              labelWidth:130,
              // formslot:true,
              type:'select'
            },{
              label: '收入日期',
              prop: 'recordTime',
              labelWidth:130,
              type:"yyyy-MM-dd"
            },
              {
                label: "上传附件",
                prop: "fileUrl",
                type: "upload",
                labelWidth:130,
                component: "zd-upload",
                dataType: "string",
                display:false
              },
              {
                label: '超期申诉原因',
                prop: 'overtimeReason',
                // width:'250',
                labelWidth:130,
                type:'textarea',
                display:this.showType==2,
                rules: [
                  { required: true, trigger: 'blur', message: '请输入超期申诉原因' },
                ]
              },{
                label: '车站备注',
                prop: 'remark',
                autoHeight: true,
                // width:'250',
                labelWidth:130,
                type:'textarea',
              }]
          },
        ]
      };
    }
  },
  mounted() {
    this.getAuth();
  }
}
</script>
<style lang="scss">
.huLianWangShouPiaojiDataInput.EditorOrAdd{
  .avue-group[index='2']{
    .avue-form__group{
      .avue-form__row{
        width: 100%;
      }
    }
  }
  @media only screen and (min-width: 992px){
    width: 100%;
  }
  .avue-crud__tip{
    display: none;
  }
}
.zhanNeiRYDLCK {
  .upload-fujian{
    display: inline-flex;
    .el-upload-list {
      display: none;
    }
  }

}
</style>
